home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual BASIC 5.0 (Ent. Edition) / Vb5ent Extractor.EXE / VB / SAMPLES / PGUIDE / BLANKER / BLANKER.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1996-09-16  |  25.8 KB  |  706 lines

  1. VERSION 5.00
  2. Begin VB.Form DemoForm 
  3.    BackColor       =   &H00000000&
  4.    Caption         =   "Screen Blanker Demo"
  5.    ClientHeight    =   3855
  6.    ClientLeft      =   960
  7.    ClientTop       =   2535
  8.    ClientWidth     =   7470
  9.    BeginProperty Font 
  10.       Name            =   "MS Sans Serif"
  11.       Size            =   8.25
  12.       Charset         =   1
  13.       Weight          =   700
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    ForeColor       =   &H00000000&
  19.    Icon            =   "BLANKER.frx":0000
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    PaletteMode     =   1  'UseZOrder
  23.    ScaleHeight     =   3855
  24.    ScaleWidth      =   7470
  25.    WhatsThisHelp   =   -1  'True
  26.    Begin VB.Timer Timer1 
  27.       Interval        =   1
  28.       Left            =   6960
  29.       Top             =   120
  30.    End
  31.    Begin VB.CommandButton cmdStartStop 
  32.       BackColor       =   &H00000000&
  33.       Caption         =   "Start Demo"
  34.       Default         =   -1  'True
  35.       Height          =   390
  36.       Left            =   240
  37.       TabIndex        =   0
  38.       Top             =   120
  39.       Width           =   1830
  40.    End
  41.    Begin VB.PictureBox picBall 
  42.       AutoSize        =   -1  'True
  43.       BackColor       =   &H00000000&
  44.       BorderStyle     =   0  'None
  45.       ForeColor       =   &H00FFFFFF&
  46.       Height          =   480
  47.       Left            =   1800
  48.       Picture         =   "BLANKER.frx":030A
  49.       ScaleHeight     =   480
  50.       ScaleWidth      =   480
  51.       TabIndex        =   1
  52.       Top             =   720
  53.       Visible         =   0   'False
  54.       Width           =   480
  55.    End
  56.    Begin VB.Image imgMoon 
  57.       Height          =   480
  58.       Index           =   8
  59.       Left            =   6330
  60.       Picture         =   "BLANKER.frx":0614
  61.       Top             =   3765
  62.       Visible         =   0   'False
  63.       Width           =   480
  64.    End
  65.    Begin VB.Line linLineCtl 
  66.       BorderColor     =   &H00FF0000&
  67.       BorderWidth     =   5
  68.       Visible         =   0   'False
  69.       X1              =   240
  70.       X2              =   4080
  71.       Y1              =   2760
  72.       Y2              =   2760
  73.    End
  74.    Begin VB.Image imgMoon 
  75.       Height          =   480
  76.       Index           =   7
  77.       Left            =   5760
  78.       Picture         =   "BLANKER.frx":091E
  79.       Top             =   3720
  80.       Visible         =   0   'False
  81.       Width           =   480
  82.    End
  83.    Begin VB.Image imgMoon 
  84.       Height          =   480
  85.       Index           =   6
  86.       Left            =   5160
  87.       Picture         =   "BLANKER.frx":0C28
  88.       Top             =   3720
  89.       Visible         =   0   'False
  90.       Width           =   480
  91.    End
  92.    Begin VB.Image imgMoon 
  93.       Height          =   480
  94.       Index           =   5
  95.       Left            =   4560
  96.       Picture         =   "BLANKER.frx":0F32
  97.       Top             =   3720
  98.       Visible         =   0   'False
  99.       Width           =   480
  100.    End
  101.    Begin VB.Image imgMoon 
  102.       Height          =   480
  103.       Index           =   4
  104.       Left            =   3960
  105.       Picture         =   "BLANKER.frx":123C
  106.       Top             =   3720
  107.       Visible         =   0   'False
  108.       Width           =   480
  109.    End
  110.    Begin VB.Image imgMoon 
  111.       Height          =   480
  112.       Index           =   3
  113.       Left            =   3360
  114.       Picture         =   "BLANKER.frx":1546
  115.       Top             =   3720
  116.       Visible         =   0   'False
  117.       Width           =   480
  118.    End
  119.    Begin VB.Image imgMoon 
  120.       Height          =   480
  121.       Index           =   2
  122.       Left            =   2760
  123.       Picture         =   "BLANKER.frx":1850
  124.       Top             =   3720
  125.       Visible         =   0   'False
  126.       Width           =   480
  127.    End
  128.    Begin VB.Image imgMoon 
  129.       Height          =   480
  130.       Index           =   1
  131.       Left            =   2160
  132.       Picture         =   "BLANKER.frx":1B5A
  133.       Top             =   3720
  134.       Visible         =   0   'False
  135.       Width           =   480
  136.    End
  137.    Begin VB.Image imgMoon 
  138.       Height          =   480
  139.       Index           =   0
  140.       Left            =   1560
  141.       Picture         =   "BLANKER.frx":1E64
  142.       Top             =   3720
  143.       Visible         =   0   'False
  144.       Width           =   480
  145.    End
  146.    Begin VB.Shape shpClone 
  147.       BackColor       =   &H00000000&
  148.       BackStyle       =   1  'Opaque
  149.       BorderColor     =   &H00FF0000&
  150.       FillColor       =   &H000000FF&
  151.       Height          =   1215
  152.       Index           =   0
  153.       Left            =   240
  154.       Top             =   720
  155.       Visible         =   0   'False
  156.       Width           =   1410
  157.    End
  158.    Begin VB.Shape Shape1 
  159.       Height          =   15
  160.       Left            =   960
  161.       Top             =   1080
  162.       Width           =   15
  163.    End
  164.    Begin VB.Menu mnuOption 
  165.       Caption         =   "&Options"
  166.       Begin VB.Menu mnuLineCtlDemo 
  167.          Caption         =   "&Jumpy Line"
  168.          Checked         =   -1  'True
  169.       End
  170.       Begin VB.Menu mnuCtlMoveDemo 
  171.          Caption         =   "Re&bound"
  172.       End
  173.       Begin VB.Menu mnuImageDemo 
  174.          Caption         =   "&Spinning Moon"
  175.       End
  176.       Begin VB.Menu mnuShapeDemo 
  177.          Caption         =   "&Madhouse"
  178.       End
  179.       Begin VB.Menu mnuPSetDemo 
  180.          Caption         =   "&Confetti"
  181.       End
  182.       Begin VB.Menu mnuLineDemo 
  183.          Caption         =   "C&rossfire"
  184.       End
  185.       Begin VB.Menu mnuCircleDemo 
  186.          Caption         =   "Rainbo&w Rug"
  187.       End
  188.       Begin VB.Menu mnuScaleDemo 
  189.          Caption         =   "Co&lor Bars"
  190.       End
  191.       Begin VB.Menu sep1 
  192.          Caption         =   "-"
  193.       End
  194.       Begin VB.Menu mnuExit 
  195.          Caption         =   "E&xit"
  196.       End
  197.    End
  198. Attribute VB_Name = "DemoForm"
  199. Attribute VB_GlobalNameSpace = False
  200. Attribute VB_Creatable = False
  201. Attribute VB_TemplateDerived = False
  202. Attribute VB_PredeclaredId = True
  203. Attribute VB_Exposed = False
  204. Option Explicit
  205. ' Declare a variable to track animation frame.
  206. Dim FrameNum
  207. ' Declare the X- and Y-coordinate variables to track position.
  208. Dim XPos
  209. Dim YPos
  210. ' Declare a variable flag to stop graphic routines in Do Loops.
  211. Dim DoFlag
  212. ' Declare a variable to track moving controls.
  213. Dim Motion
  214. ' Declare form variables for color.
  215. Dim R
  216. Dim G
  217. Dim B
  218. Private Sub CircleDemo()
  219.     ' Declare local variables.
  220.     Dim Radius
  221.     ' Create random RGB colors.
  222.     R = 255 * Rnd
  223.     G = 255 * Rnd
  224.     B = 255 * Rnd
  225.     ' Position center of circles in the center of the form.
  226.     XPos = ScaleWidth / 2
  227.     YPos = ScaleHeight / 2
  228.     ' Generate a radius between 0 and almost half the form's height.
  229.     Radius = ((YPos * 0.9) + 1) * Rnd
  230.     ' Draw a circle on the form.
  231.     Circle (XPos, YPos), Radius, RGB(R, G, B)
  232. End Sub
  233. Private Sub cmdStartStop_Click()
  234. ' Declare local variables.
  235. Dim UnClone
  236. Dim MakeClone
  237. Dim X1
  238. Dim Y1
  239.     Select Case DoFlag
  240.         Case True
  241.             cmdStartStop.Caption = "Start Demo"
  242.             DoFlag = False
  243.             mnuOption.Enabled = True
  244.             If mnuCtlMoveDemo.Checked = True Then
  245.                 ' Hide bouncing graphic again.
  246.                 picBall.Visible = False
  247.             ElseIf mnuLineDemo.Checked = True Then
  248.                 ' Remove lines from the form.
  249.                 Cls
  250.             ElseIf mnuShapeDemo.Checked = True Then
  251.                 ' Remove all dynamically loaded Shape controls.
  252.                 For UnClone = 1 To 20
  253.                     Unload shpClone(UnClone)
  254.                 Next UnClone
  255.                 ' Reset background color of form to black.
  256.                 DemoForm.BackColor = QBColor(0)
  257.                 ' Refresh form so color change takes effect.
  258.                 Refresh
  259.             ElseIf mnuPSetDemo.Checked = True Then
  260.                 ' Remove confetti bits from form.
  261.                 Cls
  262.             ElseIf mnuLineCtlDemo.Checked = True Then
  263.                 ' Hide Line control again.
  264.                 linLineCtl.Visible = False
  265.                 ' Remove any stray pixels left after hiding line.
  266.                 Cls
  267.             ElseIf mnuImageDemo.Checked = True Then
  268.                 ' Hide bouncing graphic again.
  269.                 imgMoon(0).Visible = False
  270.             ElseIf mnuScaleDemo.Checked = True Then
  271.                 ' Clear the form.
  272.                 Cls
  273.                 ' Return form to the default scale.
  274.                 Scale
  275.             ElseIf mnuCircleDemo.Checked = True Then
  276.                 ' Remove the circles from the form.
  277.                 Cls
  278.             End If
  279.         Case False
  280.             cmdStartStop.Caption = "Stop Demo"
  281.             DoFlag = True
  282.             mnuOption.Enabled = False
  283.             If mnuCtlMoveDemo.Checked = True Then
  284.                 ' Make the bouncing graphic (picture box control) visible.
  285.                 picBall.Visible = True
  286.                 ' Determine initial motion of bouncing graphic at random.
  287.                 ' Settings are 1 to 4.  The value of the Motion variable determines
  288.                 ' what part of the Do Loop routine runs.
  289.                 Motion = Int(4 * Rnd + 1)
  290.             ElseIf mnuLineDemo.Checked = True Then
  291.                 ' Initialize the random-number generator.
  292.                 Randomize
  293.                 ' Set the line width.
  294.                 DrawWidth = 2
  295.                 ' Set the initial X- and Y-coordinates to a random location on the form.
  296.                 X1 = Int(DemoForm.Width * Rnd + 1)
  297.                 Y1 = Int(DemoForm.Height * Rnd + 1)
  298.             ElseIf mnuShapeDemo.Checked = True Then
  299.                 ' Dynamically load a control array of 20 shape controls on the form.
  300.                 For MakeClone = 1 To 20
  301.                     Load shpClone(MakeClone)
  302.                 Next MakeClone
  303.             ElseIf mnuPSetDemo.Checked = True Then
  304.                 ' Set the thickness of the confetti bits.
  305.                 DrawWidth = 5
  306.             ElseIf mnuLineCtlDemo.Checked = True Then
  307.                 ' Make the line control visible.
  308.                 linLineCtl.Visible = True
  309.                 ' Set thickness of the line as it will appear.
  310.                 DrawWidth = 7
  311.             ElseIf mnuImageDemo.Checked = True Then
  312.                 ' Make the bouncing graphic (image control) visible.
  313.                 imgMoon(0).Visible = True
  314.                 ' Set initial animation frame.
  315.                 FrameNum = 0
  316.                 ' Determine the initial motion of the bouncing graphic at random.
  317.                 ' Settings are 1 to 4.  The Value of the Motion variable determines
  318.                 ' what part of the Do Loop routine runs.
  319.                 Motion = Int(4 * Rnd + 1)
  320.             ElseIf mnuScaleDemo.Checked = True Then
  321.                 ' Initialize the random-number generator.
  322.                 Randomize
  323.                 ' Set the width of the box outlines so boxes don't overlap.
  324.                 DrawWidth = 1
  325.                 ' Set the value of the X-coordinate to the left edge of form.
  326.                 ' Set the first box's X-coordinate = 1, second box = 2, and so on.
  327.                 ScaleLeft = 1
  328.                 ' Set the Y-coordinate of top edge of form to 10.
  329.                 ScaleTop = 10
  330.                 ' Set the number of units of the form width to a random number between
  331.                 ' 3 and 12.  This changes the number of boxes drawn each time the
  332.                 ' routine starts.
  333.                 ScaleWidth = Int(13 * Rnd + 3)
  334.                 ' Set the number of units in the form height to -10.  Then the height of all boxes
  335.                 ' varies from 0 to 10, and Y-coordinates start at the bottom of the form.
  336.                 ScaleHeight = -10
  337.             ElseIf mnuCircleDemo.Checked = True Then
  338.                 ' Define the width of the circle outline.
  339.                 DrawWidth = 1
  340.                 ' Draw circles as dashed lines.
  341.                 DrawStyle = vbDash
  342.                 ' Draw lines using the XOR pen, combining colors found in the pen or
  343.                 ' in the display, but not in both.
  344.                 DrawMode = vbXorPen
  345.             End If
  346.     End Select
  347. End Sub
  348. Private Sub CtlMoveDemo()
  349.     Select Case Motion
  350.     Case 1
  351.         ' Move the graphic left and up by 20 twips using the Move method.
  352.         picBall.Move picBall.Left - 20, picBall.TOP - 20
  353.         ' If the graphic reaches the left edge of the form, move it to the right and up.
  354.         If picBall.Left <= 0 Then
  355.             Motion = 2
  356.         ' If the graphic reaches the top edge of the form, move it to the left and down.
  357.         ElseIf picBall.TOP <= 0 Then
  358.             Motion = 4
  359.         End If
  360.     Case 2
  361.         ' Move the graphic right and up by 20 twips.
  362.         picBall.Move picBall.Left + 20, picBall.TOP - 20
  363.         ' If the graphic reaches the right edge of the form, move it to the left and up.
  364.         ' Routine determines the right edge of the form by subtracting the graphic
  365.         ' width from the form width.
  366.         If picBall.Left >= (DemoForm.Width - picBall.Width) Then
  367.             Motion = 1
  368.         ' If the graphic reaches the top edge of the form, move it to the right and down.
  369.         ElseIf picBall.TOP <= 0 Then
  370.             Motion = 3
  371.         End If
  372.     Case 3
  373.         ' Move the graphic right and down by 20 twips.
  374.         picBall.Move picBall.Left + 20, picBall.TOP + 20
  375.         ' If the graphic reaches the right edge of the form, move it to the left and down.
  376.         If picBall.Left >= (DemoForm.Width - picBall.Width) Then
  377.             Motion = 4
  378.         ' If the graphic reaches the bottom edge of the form, move it to the right and up.
  379.         ' Routine determines the bottom of the form by subtracting
  380.         ' the graphic height from the form height less 680 twips for the height
  381.         ' of title bar and menu bar.
  382.         ElseIf picBall.TOP >= (DemoForm.Height - picBall.Height) - 680 Then
  383.             Motion = 2
  384.         End If
  385.     Case 4
  386.         ' Move the graphic left and down by 20 twips.
  387.         picBall.Move picBall.Left - 20, picBall.TOP + 20
  388.         ' If the graphic reaches the left edge of the form, move it to the right and down.
  389.         If picBall.Left <= 0 Then
  390.             Motion = 3
  391.         ' If the graphic reaches the bottom edge of the form, move it to the left and up.
  392.         ElseIf picBall.TOP >= (DemoForm.Height - picBall.Height) - 680 Then
  393.             Motion = 1
  394.         End If
  395.     End Select
  396. End Sub
  397. Private Sub Delay()
  398.     Dim Start
  399.     Dim Check
  400.     Start = Timer
  401.     Do Until Check >= Start + 0.15
  402.         Check = Timer
  403.     Loop
  404. End Sub
  405. Private Sub Form_Load()
  406.     DoFlag = False
  407. End Sub
  408. Private Sub Form_Resize()
  409.     If mnuScaleDemo.Checked = True And DemoForm.WindowState = 0 Then
  410.         ' Initialize the random-number generator.
  411.         Randomize
  412.         ' Set the width of the box outlines to narrow so the boxes don't overlap.
  413.         DrawWidth = 1
  414.         ' Set the value of the X-coordinate of the left edge of the form to 1.
  415.         ' This makes it easy to set the position for each box.  The first box has
  416.         ' an X-coordinate of 1, the second has an X-coordinate of 2, and so on.
  417.         ScaleLeft = 1
  418.         ' Set the value of the Y-coordinate of the top edge of the form to 10.
  419.         ScaleTop = 10
  420.         ' Set the number of units in the width of the form to a random number between
  421.         ' 3 and 12.  This changes the number of boxes that are drawn each time the user
  422.         ' starts this routine.
  423.         ScaleWidth = Int(13 * Rnd + 3)
  424.         ' Set the number of units in the height of the form to -10.  This has
  425.         ' two effects.  First, all the boxes then have a height that varies from 0 to 10.
  426.         ' Second, the negative value causes the Y-coordinates to begin at the bottom
  427.         ' edge of the form instead of at the top.
  428.         ScaleHeight = -10
  429.     End If
  430. End Sub
  431. Private Sub Form_Unload(Cancel As Integer)
  432.     End
  433. End Sub
  434. Private Sub ImageDemo()
  435.     Select Case Motion
  436.     Case 1
  437.         ' Move the graphic to the left and up by 100 twips using the Move method.
  438.         imgMoon(0).Move imgMoon(0).Left - 100, imgMoon(0).TOP - 100
  439.         ' Increment animation to next frame.
  440.         IncrFrame
  441.         ' If the graphic reaches the left edge of the form, move right and up.
  442.         If imgMoon(0).Left <= 0 Then
  443.             Motion = 2
  444.         ' If the graphic reaches the top edge of the form, move left and down.
  445.         ElseIf imgMoon(0).TOP <= 0 Then
  446.             Motion = 4
  447.         End If
  448.     Case 2
  449.         ' Move the graphic right and up by 100 twips.
  450.         imgMoon(0).Move imgMoon(0).Left + 100, imgMoon(0).TOP - 100
  451.         ' Increment animation to next frame.
  452.         IncrFrame
  453.         ' If the graphic reaches the right edge of the form, move left and up.
  454.         ' Routine determines the right edge of the form by subtracting
  455.         ' the graphic width from the control width.
  456.         If imgMoon(0).Left >= (DemoForm.Width - imgMoon(0).Width) Then
  457.             Motion = 1
  458.         ' If the graphic reaches the top edge of the form, move right and down.
  459.         ElseIf imgMoon(0).TOP <= 0 Then
  460.             Motion = 3
  461.         End If
  462.     Case 3
  463.         ' Move the graphic right and down by 100 twips.
  464.         imgMoon(0).Move imgMoon(0).Left + 100, imgMoon(0).TOP + 100
  465.         ' Increment animation to next frame.
  466.         IncrFrame
  467.         ' If the graphic reaches the right edge of the form, move left and down.
  468.         If imgMoon(0).Left >= (DemoForm.Width - imgMoon(0).Width) Then
  469.             Motion = 4
  470.         ' If the graphic reaches bottom edge of form, move right and up.
  471.         ' Routine determines the bottom edge of the form by subtracting the graphic
  472.         ' height from the form height minus 680 twips for the height of the title
  473.         ' bar and menu bar.
  474.         ElseIf imgMoon(0).TOP >= (DemoForm.Height - imgMoon(0).Height) - 680 Then
  475.             Motion = 2
  476.         End If
  477.     Case 4
  478.         ' Move the graphic left and down by 100 twips.
  479.         imgMoon(0).Move imgMoon(0).Left - 100, imgMoon(0).TOP + 100
  480.         ' Increment animation to next frame.
  481.         IncrFrame
  482.         ' If the graphic reaches the left edge of the form, move right and down.
  483.         If imgMoon(0).Left <= 0 Then
  484.             Motion = 3
  485.         ' If the graphic reaches the bottom edge of the form, move left and up.
  486.         ElseIf imgMoon(0).TOP >= (DemoForm.Height - imgMoon(0).Height) - 680 Then
  487.             Motion = 1
  488.         End If
  489.     End Select
  490. End Sub
  491. Private Sub IncrFrame()
  492.     ' Increment frame number.
  493.     FrameNum = FrameNum + 1
  494.     ' Control array with animation frames has elements 0 to 7. At the eighth
  495.     ' frame, reset the frame number to 0 for an endless animation loop.
  496.     If FrameNum > 8 Then
  497.         FrameNum = 1
  498.     End If
  499.     ' Set the Picture property of the image control to the Picture property of the current frame.
  500.     imgMoon(0).Picture = imgMoon(FrameNum).Picture
  501.     ' Pause display so animation isn't too fast.
  502.     Me.Refresh
  503.     Delay
  504. End Sub
  505. Private Sub LineCtlDemo()
  506.     ' Set X- and Y-coordinates (left/right position) of the line's start position to a
  507.     ' random location on the form.
  508.     linLineCtl.X1 = Int(DemoForm.Width * Rnd)
  509.     linLineCtl.Y1 = Int(DemoForm.Height * Rnd)
  510.     ' Set X- and Y-coordinates (left/right position) of line's end position to
  511.     ' a random location on the form.
  512.     linLineCtl.X2 = Int(DemoForm.Width * Rnd)
  513.     linLineCtl.Y2 = Int(DemoForm.Height * Rnd)
  514.     ' Clear the form to remove any stray pixels.
  515.     Cls
  516.     ' Pause display before moving the line again.
  517.     Delay
  518. End Sub
  519. Private Sub LineDemo()
  520.     ' Declare local variables.
  521.     Dim X2
  522.     Dim Y2
  523.     ' Create random RGB colors.
  524.     R = 255 * Rnd
  525.     G = 255 * Rnd
  526.     B = 255 * Rnd
  527.     ' Set the end point of the line control to a random location on the form.
  528.     X2 = Int(DemoForm.Width * Rnd + 1)
  529.     Y2 = Int(DemoForm.Height * Rnd + 1)
  530.     ' Using the Line method, draw from current coordinates to current end
  531.     ' point, giving line a random color. Each line starts where the last
  532.     ' line ends.
  533.     Line -(X2, Y2), RGB(R, G, B)
  534. End Sub
  535. Private Sub mnuCircleDemo_Click()
  536.     Cls
  537.     mnuCtlMoveDemo.Checked = False
  538.     mnuLineDemo.Checked = False
  539.     mnuShapeDemo.Checked = False
  540.     mnuPSetDemo.Checked = False
  541.     mnuLineCtlDemo.Checked = False
  542.     mnuImageDemo.Checked = False
  543.     mnuScaleDemo.Checked = False
  544.     mnuCircleDemo.Checked = True
  545. End Sub
  546. Private Sub mnuCtlMoveDemo_Click()
  547.     Cls
  548.     mnuCtlMoveDemo.Checked = True
  549.     mnuLineDemo.Checked = False
  550.     mnuShapeDemo.Checked = False
  551.     mnuPSetDemo.Checked = False
  552.     mnuLineCtlDemo.Checked = False
  553.     mnuImageDemo.Checked = False
  554.     mnuScaleDemo.Checked = False
  555.     mnuCircleDemo.Checked = False
  556. End Sub
  557. Private Sub mnuExit_Click()
  558.     End
  559. End Sub
  560. Private Sub mnuImageDemo_Click()
  561.     Cls
  562.     mnuCtlMoveDemo.Checked = False
  563.     mnuLineDemo.Checked = False
  564.     mnuShapeDemo.Checked = False
  565.     mnuPSetDemo.Checked = False
  566.     mnuLineCtlDemo.Checked = False
  567.     mnuImageDemo.Checked = True
  568.     mnuScaleDemo.Checked = False
  569.     mnuCircleDemo.Checked = False
  570. End Sub
  571. Private Sub mnuLineCtlDemo_Click()
  572.     Cls
  573.     mnuCtlMoveDemo.Checked = False
  574.     mnuLineDemo.Checked = False
  575.     mnuShapeDemo.Checked = False
  576.     mnuPSetDemo.Checked = False
  577.     mnuLineCtlDemo.Checked = True
  578.     mnuImageDemo.Checked = False
  579.     mnuScaleDemo.Checked = False
  580.     mnuCircleDemo.Checked = False
  581. End Sub
  582. Private Sub mnuLineDemo_Click()
  583.     Cls
  584.     mnuCtlMoveDemo.Checked = False
  585.     mnuLineDemo.Checked = True
  586.     mnuShapeDemo.Checked = False
  587.     mnuPSetDemo.Checked = False
  588.     mnuLineCtlDemo.Checked = False
  589.     mnuImageDemo.Checked = False
  590.     mnuScaleDemo.Checked = False
  591.     mnuCircleDemo.Checked = False
  592. End Sub
  593. Private Sub mnuPSetDemo_Click()
  594.     Cls
  595.     mnuCtlMoveDemo.Checked = False
  596.     mnuLineDemo.Checked = False
  597.     mnuShapeDemo.Checked = False
  598.     mnuPSetDemo.Checked = True
  599.     mnuLineCtlDemo.Checked = False
  600.     mnuImageDemo.Checked = False
  601.     mnuScaleDemo.Checked = False
  602.     mnuCircleDemo.Checked = False
  603. End Sub
  604. Private Sub mnuScaleDemo_Click()
  605.     Cls
  606.     mnuCtlMoveDemo.Checked = False
  607.     mnuLineDemo.Checked = False
  608.     mnuShapeDemo.Checked = False
  609.     mnuPSetDemo.Checked = False
  610.     mnuLineCtlDemo.Checked = False
  611.     mnuImageDemo.Checked = False
  612.     mnuScaleDemo.Checked = True
  613.     mnuCircleDemo.Checked = False
  614. End Sub
  615. Private Sub mnuShapeDemo_Click()
  616.     Cls
  617.     mnuCtlMoveDemo.Checked = False
  618.     mnuLineDemo.Checked = False
  619.     mnuShapeDemo.Checked = True
  620.     mnuPSetDemo.Checked = False
  621.     mnuLineCtlDemo.Checked = False
  622.     mnuImageDemo.Checked = False
  623.     mnuScaleDemo.Checked = False
  624.     mnuCircleDemo.Checked = False
  625. End Sub
  626. Private Sub PSetDemo()
  627.     ' Create random RGB colors.
  628.     R = 255 * Rnd
  629.     G = 255 * Rnd
  630.     B = 255 * Rnd
  631.     ' XPos sets the horizontal position of a confetti bit to a random location on the form.
  632.     XPos = Rnd * ScaleWidth
  633.     ' YPos sets the vertical position of a confetti bit to a random location on the form.
  634.     YPos = Rnd * ScaleHeight
  635.     ' Draw a confetti bit at XPos, YPos. Assign the confetti bit a random color.
  636.     PSet (XPos, YPos), RGB(R, G, B)
  637. End Sub
  638. Private Sub ScaleDemo()
  639.     ' Declare local variables.
  640.     Dim Box
  641.     ' Creates the same number of boxes as units in the width of the form.
  642.     For Box = 1 To ScaleWidth
  643.         ' Create random RGB colors.
  644.         R = 255 * Rnd
  645.         G = 255 * Rnd
  646.         B = 255 * Rnd
  647.         ' Draw boxes using te Line method with the B (box) F (filled) options.
  648.         ' Boxes start at each X-coordinate determined by ScaleWidth and at
  649.         ' a Y-coordinate of 0 (bottom of form). Each box is 1 unit wide and
  650.         ' has a random height between 0 and 10. Fill the box with a random color.
  651.         Line (Box, 0)-Step(1, (Int(11 * Rnd))), RGB(R, G, B), BF
  652.     Next Box
  653.     ' Pause to display all boxes before redraw.
  654.     Delay
  655. End Sub
  656. Private Sub ShapeDemo()
  657.     ' Declare local variables.
  658.     Dim CloneID
  659.     ' Create random RGB colors.
  660.     R = 255 * Rnd
  661.     G = 255 * Rnd
  662.     B = 255 * Rnd
  663.     ' Set the form's background color to a random value.
  664.     DemoForm.BackColor = RGB(R, G, B)
  665.     ' Select a random shape control in the control array.
  666.     CloneID = Int(20 * Rnd + 1)
  667.     ' XPos and YPos set position of selected shape control to a random
  668.     ' location on the form.
  669.     XPos = Int(DemoForm.Width * Rnd + 1)
  670.     YPos = Int(DemoForm.Height * Rnd + 1)
  671.     ' Set the shape of the selected shape control to a random shape.
  672.     shpClone(CloneID).Shape = Int(6 * Rnd)
  673.     ' Set the height and width of a selected shape control to a random size between
  674.     ' 500 and 2500 twips.
  675.     shpClone(CloneID).Height = Int(2501 * Rnd + 500)
  676.     shpClone(CloneID).Width = Int(2501 * Rnd + 500)
  677.     ' Set the background color and DrawMode property of the shape control to a random color.
  678.     shpClone(CloneID).BackColor = QBColor(Int(15 * Rnd))
  679.     shpClone(CloneID).DrawMode = Int(16 * Rnd + 1)
  680.     ' Move the selected shape control to XPos, YPos.
  681.     shpClone(CloneID).Move XPos, YPos
  682.     ' Make the selected shape control visible.
  683.     shpClone(CloneID).Visible = True
  684.     ' Wait briefly before selecting and changing the next shape control.
  685.     Delay
  686. End Sub
  687. Private Sub Timer1_Timer()
  688.     If mnuCtlMoveDemo.Checked And DoFlag = True Then
  689.         CtlMoveDemo
  690.     ElseIf mnuLineDemo.Checked And DoFlag = True Then
  691.         LineDemo
  692.     ElseIf mnuShapeDemo.Checked And DoFlag = True Then
  693.         ShapeDemo
  694.     ElseIf mnuPSetDemo.Checked And DoFlag = True Then
  695.         PSetDemo
  696.     ElseIf mnuLineCtlDemo.Checked And DoFlag = True Then
  697.         LineCtlDemo
  698.     ElseIf mnuImageDemo.Checked And DoFlag = True Then
  699.         ImageDemo
  700.     ElseIf mnuScaleDemo.Checked And DoFlag = True Then
  701.         ScaleDemo
  702.     ElseIf mnuCircleDemo.Checked And DoFlag = True Then
  703.         CircleDemo
  704.     End If
  705. End Sub
  706.